package reflect;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

public class Test {
    public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException {
        Class cls = Class.forName("reflect.Student");
        Constructor c1 = cls.getConstructor(String.class, int.class, char.class);
        Constructor c2 = cls.getConstructor();
        Object obj1 = c1.newInstance("李四", 20, '女');
        Object obj2 = c2.newInstance();
        System.out.println( obj1);
        System.out.println( obj2);
        //Object obj = cls.newInstance();

    }
}
